#ifndef GAME_H
#define GAME_H

#include "Singleton.h"

#include <QDebug>
#include <QList>
#include <QMap>
#include <exception>
#include <QTimer>
#include <QObject>
#include <iostream>

class PersonState;
class PersonManager;

class PersonState {
public:
    PersonState(){}
    virtual ~PersonState(){}
    virtual void Do1(PersonManager* p){}
    virtual void Do2(PersonManager* p){}

    void ChangeState(PersonManager* p, PersonState* s);
};

class PersonManager {
  public:
    PersonManager();
    virtual ~PersonManager(){}
    virtual void Do1() { _state->Do1(this); }
    virtual void Do2() { _state->Do2(this); }

    friend class PersonState;
    void ChangeState(PersonState* s) { _state = s; }
    PersonState* _state;
};

class IdleState: public PersonState, public CSingleton<IdleState>{
public:
    IdleState(){}
    virtual ~IdleState(){}
    virtual void Do1(PersonManager* p);
    virtual void Do2(PersonManager* p);
};

class WalkState: public PersonState, public CSingleton<WalkState>{
public:
    WalkState(){}
    virtual ~WalkState(){}
    virtual void Do1(PersonManager* p);
    virtual void Do2(PersonManager* p);
};

class RunState: public PersonState, public CSingleton<RunState>{
public:
    RunState(){}
    virtual ~RunState(){}
    virtual void Do1(PersonManager* p);
    virtual void Do2(PersonManager* p);
};



#endif // GAME_H
